﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="TaoBaoApi_TB_BBLink" Codebehind="TB_BBLink.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>绑定淘宝宝贝</title>
</head>
<body>
    <form id="form1" runat="server">
    <div align="justify">
        <h2>本地商品和淘宝宝贝绑定</h2>
       <table width="100%">
            <tr align="left">
                <td valign="top">                   
                     <div class="menu_bg">
                        商品名称：<asp:TextBox ID="txtSPMC" runat="Server" />                        
                       <asp:Button ID="btnSpSearch" runat="server" Text="查询" Height="26px" Width="95px" OnClick="btnSpSearch_Click" /> 
                        </div> 
                       <div class="left">
                            <asp:GridView ID="gvSP" runat="Server" Width="100%" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" OnPageIndexChanging="gvSP_PageIndexChanging" OnRowCreated="gvSP_RowCreated">
                                 <Columns>
                            <asp:TemplateField>                                 
                                 <ItemTemplate>
                                    <asp:CheckBox ID="chkOne" runat="server" />
                                 </ItemTemplate> 
                            </asp:TemplateField>
                            <asp:BoundField DataField="SPDM" HeaderText="商品代码" />
                            <asp:BoundField DataField="SPMC" HeaderText="商品名称" /> 
                            <asp:TemplateField>
                                <HeaderTemplate>关联状态</HeaderTemplate>
                                <ItemTemplate><%# GetSPLinkStatus( Eval("SPDM")) %></ItemTemplate>
                            </asp:TemplateField>                         
                            </Columns> 
                                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <RowStyle BackColor="#E3EAEB" />
                                <EditRowStyle BackColor="#7C6F57" />
                                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                                <PagerStyle  HorizontalAlign="Left" />
                                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                                <AlternatingRowStyle BackColor="White" />
                            </asp:GridView>
                       </div>                     
                </td>
                <td valign="top">                    
                    <div class="menu_bg">
                         宝贝商店：<asp:DropDownList ID="ddlShop" runat="Server" />
                         宝贝名称：<asp:TextBox ID="txtBB" runat="server" />
                         范围：<asp:DropDownList ID="ddlBBChecked" runat="server" />
                         <asp:Button ID="btnBBSearch" runat="server" Text="查询" Height="24px" Width="95px" OnClick="btnBBSearch_Click" />
                    </div> 
                    <asp:GridView ID="gvBB" runat="Server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%" OnPageIndexChanging="gvBB_PageIndexChanging" OnRowCreated="gvBB_RowCreated">
                        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#E3EAEB" />
                        <EditRowStyle BackColor="#7C6F57" />
                        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle  HorizontalAlign="Left" />
                        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
                       <Columns>
                            <asp:TemplateField>
                                 <HeaderTemplate>
                                    <asp:CheckBox ID="chkAll" runat="Server" AutoPostBack="true" OnCheckedChanged="chkAll_OnCheckedChanged" />
                                 </HeaderTemplate>
                                 <ItemTemplate>
                                    <asp:CheckBox ID="chkOne" runat="server" /><asp:TextBox ID="txtGuid" runat="server" Text='<%# Eval("field1") %>' Visible="false" />
                                 </ItemTemplate> 
                            </asp:TemplateField>
                            <asp:BoundField DataField="mid" HeaderText="宝贝编号" />
                            <asp:BoundField DataField="bbmc" HeaderText="宝贝名称" />
                            <asp:TemplateField>
                                <HeaderTemplate>关联状态</HeaderTemplate>
                                <ItemTemplate><%# GetLinkStatus( Eval("field2")) %></ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <HeaderTemplate>关联明细</HeaderTemplate>
                                <ItemTemplate><%# Eval("field2") %></ItemTemplate>
                            </asp:TemplateField>                            
                       </Columns> 
                    </asp:GridView>
                </td>
            </tr>          
            <tr>
                <td colspan="2"> <asp:Button ID="btnShow" runat="server" Text="显示所选商品当前关联明细" OnClick="btnShow_Click" Height="33px"/>
                    <asp:Button ID="btnBind" runat="server" Text="关联所选商品和宝贝" OnClick="btnBind_Click" Height="33px" />
                    <asp:Button ID="btnLinkSelected" runat="server" Text="自动关联所选商品by货号" Height="33px" OnClick="btnLinkSelected_Click" />
                    <asp:Button ID="btnLinkAll" runat="Server" Text="自动关联全部商品by货号" Height="33px" OnClick="btnLinkAll_Click" />  
                    </td>
            </tr>  
            <tr>
                <td colspan="2">
                    <h2>所选商品当前关联的宝贝列表：</h2><br />
                    <asp:GridView ID="gvBB2" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" Width="100%">
                           <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                        <RowStyle BackColor="#E3EAEB" />
                        <EditRowStyle BackColor="#7C6F57" />
                        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                        <PagerStyle  HorizontalAlign="Left" />
                        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                        <AlternatingRowStyle BackColor="White" />
                       <Columns>                           
                            <asp:BoundField DataField="field1" HeaderText="淘宝编号" />
                            <asp:BoundField DataField="bbmc" HeaderText="宝贝名称" />                            
                       </Columns> 
                    </asp:GridView>
                </td>
            </tr> 
       </table> 
        
    </div>
    </form>
</body>
</html>
